package com.lemon.system.api;

import com.lemon.common.core.constant.SecurityConstants;
import com.lemon.common.core.constant.ServiceNameConstants;
import com.lemon.common.core.domain.Result;
import com.lemon.common.core.web.domain.AjaxResult;
import com.lemon.system.api.domain.BiUser;
import com.lemon.system.api.domain.BiUserThirdBind;
import com.lemon.system.api.domain.SysUser;
import com.lemon.system.api.factory.RemoteUserFallbackFactory;
import com.lemon.system.api.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 包名称：com.lemon.system.api
 * 类名称：RemoteUserService
 * 类描述：用户服务feign调用
 * 创建人：@author huangpeng
 * 创建时间：2023年05月03日 14:03
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService {

    /**
     * 通过用户名查询用户信息
     * @Title: getUserInfo
     * @Description: 通过用户名查询用户信息
     * @param username
     * @param source
     * @return: R<LoginUser>
     * @throws:
     * @author: huangpeng
     * @Date: 2023/5/3 17:07
     */
    @GetMapping("/user/info/{username}")
    Result<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 注册用户信息，后台
     * @Title: registerUserInfo
     * @Description: 注册用户信息，后台
     * @param sysUser
     * @param source
     * @return: R<Boolean>
     * @throws:
     * @author: huangpeng
     * @Date: 2023/5/3 17:06
     */
    @PostMapping("/user/register")
    Result<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 通过用户名查询用户信息，前台
     * @Title: getInfoByUserCode
     * @Description: 通过用户名查询用户信息，前台
     * @param userCode
     * @param source
     * @return: R<LoginUserWeb>
     * @throws:
     * @author: huangpeng
     * @Date: 2023/5/3 17:06
     */
    @GetMapping("api/system/baseUser/info/{userCode}")
    Result<LoginUser> getInfoByUserCode(@PathVariable("userCode") String userCode, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 通过邮箱查询用户信息，前台
     * @Title: getInfoByEmail
     * @Description: 通过邮箱查询用户信息，前台
     * @param email
     * @param source
     * @return: R<LoginUserWeb>
     * @throws:
     * @author: huangpeng
     * @Date: 2023/5/3 17:06
     */
    @GetMapping("api/system/baseUser/getInfoByEmail/{email}")
    Result<LoginUser> getInfoByEmail(@PathVariable("email") String email, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 通过手机号码查询用户信息，前台
     * @Title: getInfoByPhone
     * @Description: 通过手机号码查询用户信息，前台
     * @param phone
     * @param source
     * @return: R<LoginUserWeb>
     * @throws:
     * @author: huangpeng
     * @Date: 2023/5/3 17:06
     */
    @GetMapping("api/system/baseUser/getInfoByPhone/{phone}")
    Result<LoginUser> getInfoByPhone(@PathVariable("phone") String phone, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 注册用户信息，前台
     * @Title: registerBaseUserInfo
     * @Description: 注册用户信息，前台
     * @param baseUser
     * @param source
     * @return: R<BiUser>
     * @throws:
     * @author: huangpeng
     * @Date: 2023/5/3 17:06
     */
    @PostMapping("/baseUser/register")
    Result<BiUser> registerBaseUserInfo(@RequestBody BiUser baseUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 通过资料来源平台的当前用户唯一uid来查询用户信息
     * @Title: getInfoByOriginUid
     * @Description: 通过资料来源平台的当前用户唯一uid来查询用户信息
     * @param originUid 资料来源平台的当前用户唯一uid
     * @param thirdSource 第三方系统类型
     * @param source
     * @return: Result<LoginUser>
     * @throws: 
     * @author: huangpeng
     * @Date: 2024/12/31 11:03
     */
    @GetMapping("api/system/baseUser/getInfoByOriginUid")
    Result<LoginUser> getInfoByOriginUid(@RequestParam("originUid") String originUid, @RequestParam("thirdSource") String thirdSource, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 绑定第三方账号
     * @Title: insertThirdBind
     * @Description: 绑定第三方账号
     * @param model
     * @param source
     * @return: AjaxResult
     * @throws:
     * @author: huangpeng
     * @Date: 2025/4/10 11:11
     */
    @PostMapping("/bind/insertThirdBind")
    AjaxResult insertThirdBind(@RequestBody BiUserThirdBind model, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
